s=input()
m={}
for i in s:
    if i not in m:
        m[i]=1
    else:
        m[i]+=1
max_m=max(m.values())
for key,value in m.items():
    if value==max_m:
        print(key,value)
